package com.visizen.wisdomclass.server.client;

import com.visizen.wisdomclass.server.model.WcEquipment;
import com.visizen.wisdomclass.server.model.WcEquipmentExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

public interface WcEquipmentMapper {
    //根据equipUUID查询是否已经存在信息
    @Select("SELECT COUNT(*) FROM wc_equipment where equip_uuid=#{equipUUID}")
    int selectByEquipUUID(String equipUUID);

    //根据equipUUID更新信息
    @Update("UPDATE wc_equipment SET equip_type=#{equip_type}," +
            "equip_system=#{equip_system} WHERE equip_uuid=#{equip_uuid}")
    int updateByUUID(WcEquipment equipment);

    //根据equipUUID查询设备信息
    @Select("SELECT * FROM wc_equipment where equip_uuid=#{UUID}")
    WcEquipment selectByUUID(String UUID);


    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_equipment
     *
     * @mbggenerated
     */
    @SelectProvider(type = WcEquipmentSqlProvider.class, method = "countByExample")
    int countByExample(WcEquipmentExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_equipment
     *
     * @mbggenerated
     */
    @DeleteProvider(type = WcEquipmentSqlProvider.class, method = "deleteByExample")
    int deleteByExample(WcEquipmentExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_equipment
     *
     * @mbggenerated
     */
    @Delete({"delete from wc_equipment",
            "where equip_id = #{equip_id,jdbcType=BIGINT}"})
    int deleteByPrimaryKey(Long equip_id);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_equipment
     *
     * @mbggenerated
     */
    @Insert({
            "insert into wc_equipment (equip_id, equip_uuid, ",
            "equip_type, equip_system, ",
            "equip_register_time)",
            "values (#{equip_id,jdbcType=BIGINT}, #{equip_uuid,jdbcType=VARCHAR}, ",
            "#{equip_type,jdbcType=VARCHAR}, #{equip_system,jdbcType=VARCHAR}, ",
            "#{equip_register_time,jdbcType=TIMESTAMP})"})
    int insert(WcEquipment record);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_equipment
     *
     * @mbggenerated
     */
    @InsertProvider(type = WcEquipmentSqlProvider.class, method = "insertSelective")
    int insertSelective(WcEquipment record);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_equipment
     *
     * @mbggenerated
     */
    @SelectProvider(type = WcEquipmentSqlProvider.class, method = "selectByExample")
    @Results({
            @Result(column = "equip_id", property = "equip_id", jdbcType = JdbcType.BIGINT, id = true),
            @Result(column = "equip_uuid", property = "equip_uuid", jdbcType = JdbcType.VARCHAR),
            @Result(column = "equip_type", property = "equip_type", jdbcType = JdbcType.VARCHAR),
            @Result(column = "equip_system", property = "equip_system", jdbcType = JdbcType.VARCHAR),
            @Result(column = "equip_register_time", property = "equip_register_time", jdbcType = JdbcType.TIMESTAMP)})
    List<WcEquipment> selectByExample(WcEquipmentExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_equipment
     *
     * @mbggenerated
     */
    @Select({
            "select",
            "equip_id, equip_uuid, equip_type, equip_system, equip_register_time",
            "from wc_equipment", "where equip_id = #{equip_id,jdbcType=BIGINT}"})
    @Results({
            @Result(column = "equip_id", property = "equip_id", jdbcType = JdbcType.BIGINT, id = true),
            @Result(column = "equip_uuid", property = "equip_uuid", jdbcType = JdbcType.VARCHAR),
            @Result(column = "equip_type", property = "equip_type", jdbcType = JdbcType.VARCHAR),
            @Result(column = "equip_system", property = "equip_system", jdbcType = JdbcType.VARCHAR),
            @Result(column = "equip_register_time", property = "equip_register_time", jdbcType = JdbcType.TIMESTAMP)})
    WcEquipment selectByPrimaryKey(Long equip_id);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_equipment
     *
     * @mbggenerated
     */
    @UpdateProvider(type = WcEquipmentSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") WcEquipment record,
                                 @Param("example") WcEquipmentExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_equipment
     *
     * @mbggenerated
     */
    @UpdateProvider(type = WcEquipmentSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") WcEquipment record,
                        @Param("example") WcEquipmentExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_equipment
     *
     * @mbggenerated
     */
    @UpdateProvider(type = WcEquipmentSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(WcEquipment record);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_equipment
     *
     * @mbggenerated
     */
    @Update({"update wc_equipment",
            "set equip_uuid = #{equip_uuid,jdbcType=VARCHAR},",
            "equip_type = #{equip_type,jdbcType=VARCHAR},",
            "equip_system = #{equip_system,jdbcType=VARCHAR},",
            "equip_register_time = #{equip_register_time,jdbcType=TIMESTAMP}",
            "where equip_id = #{equip_id,jdbcType=BIGINT}"})
    int updateByPrimaryKey(WcEquipment record);
}